Replication data .do file for:
"The Direct Election of Senators and the Emergence of the Modern Presidency"
by Thomas R. Gray, Jeffery A. Jenkins, and Philip B. K. Potter

Political Science Research and Methods

January 24, 2020

*Set working directory to folder containing all three datasets.*

*Load Senate roll-call data*
use "GJP PSRM Senate Replication Data.dta", clear

*Table 1*
*Table 1 Model 1*
reg provote i.treatment i.pressparty i.voteid c.cong##i.state i.icpsr, cluster(icpsr)

*Table 1 Model 2*
clogit provote i.treatment i.pressparty i.voteid c.cong##i.state, group(icpsr) cluster(icpsr)

*Table 1 Model 3*
reg provote i.treatment i.pressparty i.voteid c.cong##i.state, cluster(state)

*Table 1 Model 4*
clogit provote i.treatment i.pressparty i.voteid c.cong##i.state, group(state) cluster(state)

*Table 2*
*Table 2 Model 1*
reg provote i.treatment##i.pressparty i.voteid c.cong##i.state i.icpsr, cluster(icpsr)

*Table 2 Model 2*
clogit provote i.treatment##i.pressparty i.voteid c.cong##i.state i.icpsr, group (icpsr) cluster(icpsr)

*Table 2 Model 3*
reg provote i.treatment##i.pressparty i.voteid c.cong##i.state, cluster(state)

*Table 2 Model 4*
clogit provote i.treatment##i.pressparty i.voteid c.cong##i.state, group(state) cluster(state)

*For use subsequently in Figure A1*
quietly reg provote i.treatment i.pressparty i.voteid c.cong##i.state, cluster(state)
margins, dydx(treatment)

*Figure 2
quietly reg provote i.treatment##i.pressparty i.voteid c.cong##i.state, cluster(state)
margins, at(pressparty=(0 1) treatment=(1 0)) 
*Manual graph creation based on results across two datasets*
clear
set obs 4
*Creating ID variable
gen id=_n
*Set category means
gen cons=.
replace cons= .389 in 1
replace cons= .506 in 2
replace cons= .764 in 3
replace cons= .63 in 4
twoway (bar cons id, barwidth(.9) fcolor(gs10) lcolor(black) fysize(76) ///
yscale(range(`ymin' `ymax')) ylabel(0 [.2] 1, labsize(small) nogrid) ytitle(Probability of Delegation, size(small)) ///
 xscale(range(.5 4.5) off) xtitle("") xlabel(none))
*Custom text changes in Graph Editor to produce the full Figure 2
graph export "Figure 2 replication.pdf", as(pdf) name("Graph") replace




*Load committees data*
use "GJP PSRM Committees Replication Data.dta", clear

xtset icpsr cong
set matsize 5000

xtreg test difdirect copartisan, fe
xttobit test difdirect copartisan i.icpsr, ul(1) ll(0)


*Appendix A*

use "GJP PSRM Appendix Replication Data.dta", clear

*Table A1*
*Table A1 Model 1*
reg provote i.icpsr i.treatment i.pressparty i.voteid c.cong##i.state, cluster(icpsr)

*Table A1 Model 2*
clogit provote i.treatment i.pressparty i.voteid c.cong##i.state, group(icpsr) cluster(icpsr)

*Table A1 Model 3*
reg provote i.treatment i.pressparty i.voteid c.cong##i.state, cluster(state)

*Table A1 Model 4*
clogit provote i.treatment i.pressparty i.voteid c.cong##i.state, group(state) cluster(state)

*Figure A1*
*Created custom based on result of two separate regressions and margins command.  For the House:*
quietly reg provote i.treatment i.pressparty i.voteid c.cong##i.state, cluster(state)
margins, dydx(treatment)
*For the Senate, use the result of the margin command in line _(45)_ *
*Values entered into dataset as variables figa1hou, figa1marg, figa1marglo, and figa1marghi*
graph twoway scatter figa1marg figa1hou if figa1hou==1, mcolor(gray) legend(off) || scatter figa1marg figa1hou if figa1hou==0, mcolor(black) || rcap figa1marglo figa1marghi figa1hou if figa1hou==1, lcolor(gray) || rcap figa1marglo figa1marghi figa1hou if figa1hou==0, lcolor(black)
graph export "Figure A1 replication.pdf", as(pdf) name("Graph") replace

*Table A2*
*Table A2 Model 1*
reg provote i.icpsr i.treatment##i.pressparty i.voteid c.cong##i.state, cluster(icpsr)

*Table A2 Model 2*
clogit provote i.treatment##i.pressparty i.voteid c.cong##i.state, group (icpsr) cluster(icpsr)

*Table A2 Model 3*
reg provote i.treatment##i.pressparty i.voteid c.cong##i.state, cluster(state)

*Table A2 Model 4*
clogit provote i.treatment##i.pressparty i.voteid c.cong##i.state, group(state) cluster(state)
